package com.czy.owner.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.Log;
import android.view.ViewGroup;

import java.util.List;

/**
 * Created by King on 2016/5/20 0020.
 */
public class MessageFragmentAdapter extends FragmentPagerAdapter {
    private List<Fragment> fragments;

    public MessageFragmentAdapter(FragmentManager fm, List<Fragment> fragments) {
        super(fm);
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Override
    public void finishUpdate(ViewGroup container) {
        try{
            super.finishUpdate(container);
        } catch (NullPointerException nullPointerException){
            Log.d("King","Catch the NullPointerException in FragmentPagerAdapter.finishUpdate");
            nullPointerException.printStackTrace();
        }
    }
}
